home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / imc9104.zip / MOUSE4J.C < prev    next >
Text File  |  1991-03-05  |  2KB  |  67 lines

  1. /*******************************************************************
  2. * Customizing the graphics mouse cursor: code from Figure 4J       *
  3. *******************************************************************/
  4. #include <conio.h>  /* kbhit(), getch()     */
  5. #include <dos.h>    /* int86(), union REGS  */
  6. #include <stdio.h>  /* puts()               */
  7. #include <stdlib.h> /* exit(), EXIT_FAILURE */
  8. #include <graph.h>
  9.  
  10. void main(void)
  11.     {
  12.     union REGS regs;
  13.     struct SREGS sregs;
  14.     unsigned int bullseye[]=
  15.         {
  16.         /* Screen Mask */
  17.         0x0000, 0x0000, 0x0000, 0x0000,
  18.         0x0000, 0x0000, 0x03c0, 0x03c0,
  19.         0x0000, 0x0000, 0x0000, 0x0000,
  20.         0x0000, 0x0000, 0xffff, 0xffff,
  21.         /* Cursor Mask */
  22.         0xaaaa, 0xaaaa, 0x9556, 0x9556,
  23.         0x9ff6, 0x9ff6, 0x9ff6, 0x9ff6,
  24.         0x9ff6, 0x9ff6, 0x9556, 0x9556,
  25.         0xaaaa, 0xaaaa, 0x0000, 0x0000
  26.         };
  27.     unsigned int *f = bullseye;
  28.     char fred[100];
  29.  
  30.     _setvideomode(_MRES4COLOR);
  31.     _selectpalette(0);
  32.  
  33.     /* Initialize the mouse */
  34.     regs.x.ax = 0x00;
  35.     int86(0x33, ®s, ®s);
  36.     if (!regs.x.ax)
  37.         {
  38.         puts("ERROR-can't initialize mouse");
  39.         exit(EXIT_FAILURE);
  40.         }
  41.  
  42.     /* Show the mouse */
  43.     regs.x.ax = 0x01;
  44.     int86(0x33, ®s, ®s);
  45.  
  46.     /* Wait for the user to quit */
  47.     puts("You can now see the mouse");
  48.     puts("Press RETURN key to quit");
  49.  
  50.     /* Set the shape of the mouse */
  51.     regs.x.ax = 9;
  52.     regs.x.bx = 7;
  53.     regs.x.cx = 7;
  54.     regs.x.dx = FP_OFF(f);
  55.     sregs.es  = FP_SEG(f);
  56.     int86x(0x33,®s,®s,&sregs);
  57.  
  58.     /* Wait for a carriage return */
  59.     gets(fred);
  60.     
  61.     /* Hide the mouse */
  62.     regs.x.ax = 0x02;
  63.     int86(0x33, ®s, ®s);
  64.  
  65.     _setvideomode(_DEFAULTMODE);
  66.     }
  67.